package net.cyndeline.rldungeon.dgs

/**
 * Stores the result of computing ranges for the maximum amount of responders that should be placed on a map to
 * reduce the number of pointless areas.
 *
 * @param minimumResponderAmountOnMainPath The minimum amount of responders that should be placed on edges along the
 *                                         main path of a level (inclusive). Cannot be negative.
 * @param maximumResponderAmountOnMainPath The maximum amount of responders that should be placed on edges along the
 *                                         main path of a level (exclusive). Must be higher than the minimum amount.
 * @param minimumResponderAmountOutsideMainPath The minimum amount of responders that should be placed on edges outside
 *                                              the main path of a level (inclusive). Cannot be negative.
 * @param maximumResponderAmountOutsideMainPath The maximum amount of responders that should be placed on edges outside
 *                                              the main path of a level (exclusive). Must be higher than the minimum amount.
 */
final case class ActivatorResponderAmountResult(minimumResponderAmountOnMainPath: Int,
                                                maximumResponderAmountOnMainPath: Int,
                                                minimumResponderAmountOutsideMainPath: Int,
                                                maximumResponderAmountOutsideMainPath: Int) {
  if (minimumResponderAmountOnMainPath < 0)
    throw new IllegalArgumentException("The minimum amount of responders on the main path must be equal or higher than 0 (currently " + minimumResponderAmountOnMainPath + ").")

  if (minimumResponderAmountOutsideMainPath < 0)
    throw new IllegalArgumentException("The minimum amount of responders outside the main path must be equal or higher than 0 (currently " + minimumResponderAmountOutsideMainPath + ").")

  if (minimumResponderAmountOnMainPath >= maximumResponderAmountOnMainPath)
    throw new IllegalArgumentException("The maximum amount of responders on the main path (" + maximumResponderAmountOnMainPath + ") must be higher than the minimum (" + minimumResponderAmountOnMainPath + ").")

  if (minimumResponderAmountOutsideMainPath >= maximumResponderAmountOutsideMainPath)
    throw new IllegalArgumentException("The maximum amount of responders outside the main path (" + maximumResponderAmountOutsideMainPath + ") must be higher than the minimum (" + minimumResponderAmountOutsideMainPath + ").")

}
